package util;

import com.alibaba.fastjson.JSONObject;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.function.Consumer;

public class MyCommonUtils {
    public static <T> ArrayList<T> iterToList(Iterable<T> eles) {
        ArrayList<T> list = new ArrayList<>();
        eles.forEach(list::add);
        return list;
    }

    public static long toLongTypeTs(String ts) {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        long time = 0;
        try {
            time = simpleDateFormat.parse(ts).getTime();
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return time;
    }
}
